package entities.vo;

import java.util.Vector;

public class ItemFacturaVO implements ItemTablaVO {
	private static final long serialVersionUID = 1L;
	
	private FacturaVO factura;
	private int cant;
	private float precioCobrado;
	private ArticuloVO articulo;
	private Boolean oferta;
	private String	detalle;
	private Float precioTotal;
	public ItemFacturaVO(FacturaVO factura, int cant, float precioCobrado,
			ArticuloVO articulo) {
		super();
		this.factura = factura;
		this.cant = cant;
		this.precioCobrado = precioCobrado;
		this.articulo = articulo;
	}
	public Boolean getOferta() {
		return oferta;
	}
	public void setOferta(Boolean oferta) {
		this.oferta = oferta;
	}
	public ItemFacturaVO() {
		// TODO Auto-generated constructor stub
	}

	public FacturaVO getFactura() {
		return factura;
	}
	public void setFactura(FacturaVO factura) {
		this.factura = factura;
	}
	public int getCant() {
		return cant;
	}
	public void setCant(int cant) {
		this.cant = cant;
	}
	public float getPrecioCobrado() {
		return precioCobrado;
	}
	public void setPrecioCobrado(float precioCobrado) {
		this.precioCobrado = precioCobrado;
	}
	public ArticuloVO getArticulo() {
		return articulo;
	}
	public void setArticulo(ArticuloVO articulo) {
		this.articulo = articulo;
	}

	

	public void setId(int id) {
		articulo.setReferencia(id);
	}

	public Vector<Object> toVector() {
		Vector<Object> vector = new Vector<Object>();
		vector.add(getCant());
		vector.add(this);
		vector.add(getPrecioCobrado());
		vector.add(getOferta());
		vector.add(getPrecioTotal());
		
		return vector;
	}

	public Float getPrecioTotal() {
		precioTotal = new Float(0);
		precioTotal = getCant()*getPrecioCobrado();
		return precioTotal;
	}

	public void setPrecioTotal(Float precioTotal) {
		this.precioTotal = precioTotal;
	}
	@Override
	public String toString() {
		return getDetalle();
	}
	public String getDetalle() {
		detalle = "";
		if(getArticulo()!=null){
			detalle+= getArticulo().getReferencia() +" - "+getArticulo().getDescripcion();
		}
		return detalle;
	}

	public void setDetalle(String detalle) {
		this.detalle = detalle;
	}
	public int getId() {
		return articulo.getReferencia();
	}
		
}
